#!/usr/bin/env perl

use utf8;
use strict;
no warnings 'experimental::smartmatch';
use 5.010001;

my $number = int(1 + rand 100);
my $win_msg;

while(<>){
	last if /quit|exit|\A\n/i;
	chomp;
	given($_){
		when(! /\A\d+\Z/){
			say "Input Error";
		}
		when($_ > $number){
			say "Too Hight";
		}
		when($_ < $number){
			say "Too Low";
		}
		when($_ == $number){
			$win_msg = "You Win , secret number = $number\n";
			last;
		}
		default {say "Input Error";}	
	}
}

print $win_msg // '';

print "Program exit ...\n";